<?php

namespace app\api\controller;

use app\common\lib\Param;
use app\common\lib\Show;
use app\common\lib\Str;
use app\Request;
use think\facade\Cache;
use think\response\Json;

class FeedBack extends AuthBase
{
    /**
     * 意见反馈
     * @return Json
     */
    public function feedback(): Json
    {
        $content=$this->request->post('content');

        if(empty($content)){
            return Show::error([], '反馈内容不能为空');
        }
        $data=[
            'content'=>$content,
            'user_id'=>$this->userId
        ];
        try {
            $result = (new \app\common\business\FeedBack())->save($data);
        } catch (\Exception $e) {
            return Show::error([], $e->getMessage(), $e->getCode());
        }
        if ($result) {
            return Show::success([], "保存成功");
        }
        return Show::error([], '保存失败');
    }
}
